import http from '../utils/request'

import IBaseObj from '#/index'

export function getTime() {
  return http({
    url: '/sys/check/systemDate',
    method: 'get',
  })
}

export const orgType = {
  other: '101601', // 其它
  cro: '101601', // CRO
  sbdw: '101602', // 申办单位
  yjdw: '101603', // 研究单位
}

export const orgTypeCode = [
  orgType.cro, // CRO
  orgType.sbdw, // 申办单位
  orgType.yjdw, // 研究单位
]

// 获取机构类型
export const getOrgClsList = (data: string[] = orgTypeCode) =>
  http({
    url: '/org/list/cls',
    method: 'post',
    data,
  })

export const getOrgClsListByPid = (pid: string, type: string) =>
  http({
    url: `/ctms/project/list/org/${pid}/type/${type}`,
    method: 'get',
  })

export const getViewerData = (data: IBaseObj) =>
  http(
    {
      url: '/vw/genViewerData',
      method: 'post',
      data,
    },
    true
  )
